package com.example.pdftoofd.result;

public class BaseResult {
    private int code;
    private String message;
    private Object body;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getBody() {
        return body;
    }

    public void setBody(Object body) {
        this.body = body;
    }

    public BaseResult code(int code) {
        this.code = code;
        return this;
    }

    public BaseResult message(String message) {
        this.message = message;
        return this;
    }

    public BaseResult body(Object body) {
        this.body = body;
        return this;
    }

    public static BaseResult success() {
        return new BaseResult().code(200);
    }

    public static BaseResult success(String message, Object body) {
        return new BaseResult().code(200).message(message).body(body);
    }

    public static BaseResult fail() {
        return new BaseResult().code(500);
    }

    public static BaseResult fail(String message) {
        return new BaseResult().code(500).message(message);
    }
}
